// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import axios from 'axios';



Vue.config.productionTip = false
Vue.prototype.axios=axios;


router.beforeEach((to,from,next)=>{
  // to 从哪里来
  // from 要去哪里
  // next 放行 next('/login') 强制你去/login
  // if(to.path=='/login'){
  //   next();
  // }
  // let auth =localStorage.getItem('auth');
  // if (!auth){
  //   next('/loign')
  // }else{
  //   next()
  // }

  if(to.path=='/Login') next();
  let auth=localStorage.getItem('auth');
  if (!auth) next('/Login');
  next();

})

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
